<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新增计算规则</title>
</head>
<body>
<div ng-app="myApp" ng-controller="RuleCtrl">
    <ui-form key="ruleAdd" column="2">
        <ui-form-region label="省份" p-name="toProvince" ></ui-form-region>
        <ui-form-select-remote
                url="system/supplier/listall"
                label="商家:"
                name="supplierCode"`
                value-name="code"
                text-name=""name>
        </ui-form-select-remote>
        <ui-form-select name="direction" label="运单配送类型">
            <option value="">请选择配送类型</option>
            <option value="0">配送</option>
            <option value="1">上门换</option>
            <option value="2">上门退</option>
        </ui-form-select>
        <ui-form-select-remote
                url="system/carrier/listall"
                label="承运商:"
                name="carrierCode"
                value-name="carrierCode"
                text-name=""carrierName>
        </ui-form-select-remote>
        <ui-form-select name="type" label="区间类型">
            <option value="">请选择区间类型</option>
            <option value="0">按件计费</option>
            <option value="1">按重计费</option>
        </ui-form-select>
        <ui-form-select-remote
                url="rule/settlementregion/listall"
                label="结算区域:"
                name="regionId"
                value-name="id"
                text-name="name">
        </ui-form-select-remote>
        <ui-form-select name="settlementType" label="价格类型:">
            <option value="">请选择价格类型</option>
            <option value="0">投递员价</option>
            <option value="1">合作站价</option>
            <option value="2">合作商价</option>
            <option value="3">大型合作商价</option>
        </ui-form-select>
        <ui-form-region label="发货省"  p-name="fromProvince" c-name="fromCounty"></ui-form-region>
        <ui-form-input name="firstPiecePrice" label="首件:"></ui-form-input>
        <ui-form-input name="secondPrice" label="拖件:"></ui-form-input>
        <ui-form-input name="cod" label="代收款:"></ui-form-input>
        <ui-form-input name="direction" label="上门退换:"></ui-form-input>
        <ui-form-input name="expressScheduleType" label="当日达:"></ui-form-input>
        <ui-form-input name="temperature" label="冷链:"></ui-form-input>
        <ui-form-input name="cainiao" label="菜鸟驿站:"></ui-form-input>


        <ui-form-input name="pointLeft" label="大于:"></ui-form-input>
        <ui-form-input name="pointRight" label="小于等于:"></ui-form-input>
        <ui-form-input name="firstWeight" label="首重:"></ui-form-input>
        <ui-form-input name="firstPrice" label="首重单价:"></ui-form-input>
        <ui-form-input name="secondWeight" label="续重:"></ui-form-input>
        <ui-form-input name="secondPrice" label="续重单价:"></ui-form-input>
        <ui-form-select name="isCombined" label="是否组包:">
            <option value="0">否</option>
            <option value="1">是</option>
        </ui-form-select>

    </ui-form>

</div>
<script>
    angular.module('myApp', ['ui.form']);
    angular.module('myApp').controller('RuleCtrl', function ($scope) {
        $scope.$on('ui.form.submit',function (event,param) {
            $.ajax({
                url:"rule/piece/add",
                type:"post",
                data:param
            }).done(function (result) {
                if(result.code=='0000'){
                    toastr.success("新增成功");
                    if(opener && opener.reloadTable){
                        opener.reloadTable({});
                    }
                    setTimeout(function () {
                        window.close();
                    },1500);
                }else{
                    toastr.error(result.msg);
                }
            }).fail(function (err) {

            });
        })
    });
</script>
</body>
</html>
